package com.yutianran.ezadapter;


public class LayoutHolder<T> implements LayoutPlayer<T> {

    private int layoutId;
    private LayoutPlayer<T> player;

    public LayoutHolder() {
        if (layoutId == 0) {
            this.layoutId = createLayoutId();
        }
    }

    public LayoutHolder(int layoutId) {
        this.layoutId = layoutId;
    }

    public LayoutHolder(int layoutId, LayoutPlayer<T> player) {
        this.layoutId = layoutId;
        this.player = player;
    }

    public int createLayoutId() {
        return -1;
    }

    @Override
    public void bindData(T t, CommonViewHolder viewHolder) {
        if (player != null) {
            player.bindData(t, viewHolder);
        }
    }

    public int getLayoutId() {
        return layoutId;
    }
}
